<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        *{margin: 0;
            padding: 0;}
        h5{
            display: inline-block;

        }
        span{
            display: inline-block;
            width: 20px;
            height: 15px;
            border:#999999 solid 1px;
            margin-left: 3px;
            font-max-size: 12px;
            text-align: center;
            line-height: 15px;
        }
        input{
            width: 20px;
            height: 15px;
            border: none;
            border: #999999 solid 1px;
            text-align: center;
        }
    </style>
</head>
<body>
<div class="box">
    <h5><span class="leftbtn">-</span><input type="text" id="num" value="1"><span class="rightbtn">+</span></h5>
</div>

</body>
</html>
<script>
    var rBtn=document.querySelector(".rightbtn");
    var lBtn=document.querySelector(".leftbtn");
    var num=document.getElementById("num");
    rBtn.onclick=function () {
        num.value++
    }
    lBtn.onclick=function () {
        num.value--;
      if(num.value<=1){
          num.value=1;
      }
    }
</script>